Skip to content

[INFRA-393] feat: add workflows, project templates, and ProjectFeature fields#38

Merged
Prashant-Surya merged 3 commits into
mainfrom
infra-393/sdk-project-level-apis
May 29, 2026
Merged

[INFRA-393] feat: add workflows, project templates, and ProjectFeature fields#38
Prashant-Surya merged 3 commits into
mainfrom
infra-393/sdk-project-level-apis

Conversation

@mguptahub
Copy link
Copy Markdown
Contributor

@mguptahub mguptahub commented May 27, 2026

Summary

  • Add Workflows API resource with list/create/update and sub-resources:
    • WorkflowStatesattach / detach states to a workflow
    • WorkflowTransitions — full CRUD for state transitions
  • Add ProjectTemplates API resource with two sub-resources:
    • ProjectWorkItemTemplateslist / create / update / delete
    • ProjectPageTemplateslist / create / update / delete
  • Extend ProjectFeature model with the 3 missing fields (workflows, parallel_cycles, project_updates) — was 7 fields, now all 10
  • Export all new classes from plane/__init__.py
  • Add unit tests for workflows, project templates, and update existing project feature tests to cover all 10 fields

Test plan

  • tests/unit/test_workflows.py — list, create, update workflow; attach/detach states; list, create, update, delete transitions
  • tests/unit/test_project_templates.py — CRUD for work item templates and page templates
  • tests/unit/test_projects.pytest_get_features and test_update_features assert all 10 ProjectFeature fields

Co-authored-by: Plane AI noreply@plane.so

Summary by CodeRabbit

  • New Features
    • Workflow management: create, update, attach/detach states, and manage transitions.
    • Project templates: work-item and page templates with full CRUD.
    • Enhanced project feature flags including workflows and parallel cycles support.
  • Tests
    • Added end-to-end unit tests covering workflows and project templates CRUD and listing.

Review Change Stack

…FRA-393)

- Add Workflows API resource with list/create/update and sub-resources for
  WorkflowStates (attach/detach) and WorkflowTransitions (CRUD)
- Add ProjectTemplates API resource with WorkItemTemplates and PageTemplates
  sub-resources, each supporting list/create/update/delete
- Extend ProjectFeature model with missing fields: workflows, parallel_cycles,
  project_updates (was 7 fields, now all 10)
- Export all new classes from plane/__init__.py
- Add unit tests for workflows, project templates, and updated project feature tests

Co-authored-by: Plane AI <noreply@plane.so>
@makeplane
Copy link
Copy Markdown

makeplane Bot commented May 27, 2026

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Adds Workflow and Project Template models and API clients, wires them into PlaneClient and package exports, extends ProjectFeature flags, and adds tests for the new APIs.

Changes

Workflow API Feature

Layer / File(s) Summary
Workflow data models
plane/models/workflows.py
Workflow, CreateWorkflow, UpdateWorkflow, AttachWorkflowStates, WorkflowTransition, CreateWorkflowTransition, UpdateWorkflowTransition Pydantic models.
Workflow API clients
plane/api/workflows/base.py, plane/api/workflows/states.py, plane/api/workflows/transitions.py
Workflows, WorkflowStates, WorkflowTransitions clients with list/create/update/delete and attach/detach behaviors, and response normalization/error handling.
Workflow package exports
plane/api/workflows/__init__.py
Re-exports Workflows, WorkflowStates, WorkflowTransitions via all.
Workflow API tests
tests/unit/test_workflows.py
Smoke and CRUD tests for workflows, state attach/detach, and transition CRUD with fixtures and guards.

Project Templates API Feature

Layer / File(s) Summary
Project template data models
plane/models/project_templates.py
WorkItemTemplate, CreateWorkItemTemplate, UpdateWorkItemTemplate, PageTemplate, CreatePageTemplate, UpdatePageTemplate models.
Project template API clients
plane/api/project_templates/base.py, plane/api/project_templates/work_item_templates.py, plane/api/project_templates/page_templates.py
ProjectTemplates, ProjectWorkItemTemplates, ProjectPageTemplates clients with list/create/update/delete and response normalization.
Project templates package export
plane/api/project_templates/__init__.py
Re-exports ProjectTemplates, ProjectWorkItemTemplates, ProjectPageTemplates via all.
Project template API tests
tests/unit/test_project_templates.py
Smoke and CRUD tests for work-item and page templates using fixtures and cleanup.

Client and Module Integration

Layer / File(s) Summary
Feature flags and tests
plane/models/projects.py, tests/unit/test_projects.py
Adds workflows, parallel_cycles, project_updates flags to ProjectFeature; extends tests to assert these fields.
PlaneClient integration & exports
plane/client/plane_client.py, plane/__init__.py, plane/api/projects.py
Initializes self.workflows and self.project_templates on PlaneClient; updates top-level package exports to include new APIs/models; minor trailing-line adjustment in projects API.

Sequence Diagram

sequenceDiagram
  participant User
  participant PlaneClient
  participant Workflows
  participant WorkflowStates
  participant WorkflowTransitions
  participant ProjectTemplates
  User->>PlaneClient: client.workflows
  PlaneClient->>Workflows: list/create/update workflows
  Workflows-->>PlaneClient: Workflow[] / Workflow
  User->>PlaneClient: client.workflows.states.attach/detach
  PlaneClient->>WorkflowStates: attach(state_ids) / detach(state_id)
  WorkflowStates-->>PlaneClient: None
  User->>PlaneClient: client.workflows.transitions.create/list/update/delete
  PlaneClient->>WorkflowTransitions: CRUD transitions
  WorkflowTransitions-->>PlaneClient: WorkflowTransition | None
  User->>PlaneClient: client.project_templates
  PlaneClient->>ProjectTemplates: access work_item/page templates
  ProjectTemplates-->>PlaneClient: Template[] / Template
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • sriramveeraghanta
  • dheeru0198
  • Prashant-Surya

Poem

🐰 I hopped through code with tiny paws,
Added workflows, transitions, and template laws,
Models snug, APIs in line,
Clients wired, tests all fine,
A rabbit cheers — the SDK's awfully pawsome!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main changes: adding workflows, project templates, and ProjectFeature fields.
Docstring Coverage ✅ Passed Docstring coverage is 86.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch infra-393/sdk-project-level-apis

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (1)
tests/unit/test_project_templates.py (1)

33-37: ⚡ Quick win

Use higher-entropy test names to reduce collision-driven flakes.

int(time.time()) has 1-second granularity, so fast/parallel test runs can reuse names.

Proposed fix
+from uuid import uuid4
@@
-            name=f"Test WI Template {int(time.time())}",
+            name=f"Test WI Template {uuid4().hex}",
@@
-        data = CreateWorkItemTemplate(name=f"Delete Me WI {int(time.time())}")
+        data = CreateWorkItemTemplate(name=f"Delete Me WI {uuid4().hex}")
@@
-            name=f"Test Page Template {int(time.time())}",
+            name=f"Test Page Template {uuid4().hex}",
@@
-        data = CreatePageTemplate(name=f"Delete Me Page {int(time.time())}")
+        data = CreatePageTemplate(name=f"Delete Me Page {uuid4().hex}")

Also applies to: 106-107, 130-134, 202-203

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/test_project_templates.py` around lines 33 - 37, Test names use
int(time.time()) which has 1s granularity and causes collisions; update all uses
of CreateWorkItemTemplate name formatting to use a higher-entropy suffix (e.g.,
uuid.uuid4().hex or time.time_ns()) instead of int(time.time()) — search for
CreateWorkItemTemplate in tests/unit/test_project_templates.py (the occurrences
around lines ~33, ~106, ~130, ~202) and replace the timestamp-based suffix with
a uuid4 or nanosecond timestamp to ensure unique names across fast/parallel
runs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plane/api/project_templates/page_templates.py`:
- Around line 27-29: Update all API endpoint strings in
plane/api/project_templates/page_templates.py to include a trailing slash so
they follow the SDK URL convention; specifically change the f-strings used in
the _get calls (e.g., the occurrences like
f"{workspace_slug}/projects/{project_id}/pages/templates") and the other
endpoints referenced around lines 47-50, 71-74, and 90 to end with "/" (e.g.,
".../templates/") ensuring every resource path uses the
"{base_path}/api/v1{resource_base_path}/{endpoint}/" pattern.

In `@plane/api/project_templates/work_item_templates.py`:
- Around line 27-29: The API URL strings built in this resource are missing
trailing slashes; update every occurrence where the code calls self._get /
self._post with endpoints like
f"{workspace_slug}/projects/{project_id}/workitems/templates" (and the other
three occurrences referenced at lines 47-50, 71-74, and 90) to append a trailing
"/" so the endpoints follow the SDK convention
"{base_path}/api/v1{resource_base_path}/{endpoint}/"; ensure each URL string
used in the class (the self._get/self._post calls) ends with "/" before calling
the request helper.

In `@plane/api/workflows/__init__.py`:
- Line 5: The __all__ list in the module is not alphabetically sorted (currently
__all__ = ["Workflows", "WorkflowStates", "WorkflowTransitions"]) which triggers
Ruff RUF022; update the module-level __all__ to be sorted lexicographically so
the entries are in alphabetical order (e.g., reorder the elements of the __all__
list) while keeping the same exported names and quoting style.

In `@plane/api/workflows/base.py`:
- Around line 28-29: The workflow endpoint URLs are missing required trailing
slashes causing potential 404s; update all calls that build workflow resource
paths (e.g., the self._get calls that construct
f"{workspace_slug}/projects/{project_id}/workflows", the similar f-strings
around lines referencing project/workflows and workflow_runs) to append a
trailing '/' so they follow the API convention (e.g., change ".../workflows" to
".../workflows/"); ensure every endpoint string returned to
self._get/self._post/etc. for workflows and workflow runs consistently ends with
a '/'.

In `@plane/api/workflows/states.py`:
- Around line 29-30: The endpoint URL strings for workflow states are missing
the required trailing slash; update the constructed paths (the f-strings that
use workspace_slug, project_id, workflow_id and the "/states" segment) to append
a trailing "/" so they follow the URL convention (e.g.
f"{workspace_slug}/projects/{project_id}/workflows/{workflow_id}/states/"); make
the same change for the other occurrence noted (the f-string at the other call
that builds ".../states") so all API calls to the workflow-state endpoints end
with a trailing slash and match the
`{base_path}/api/v1{resource_base_path}/{endpoint}/` pattern.

In `@plane/api/workflows/transitions.py`:
- Around line 34-35: Update the transition endpoint strings so they always end
with a trailing slash and follow the API URL convention (include the /api/v1
prefix and resource base path). Specifically, change the f-string that builds
the "state-transitions" endpoint (e.g.
f"{workspace_slug}/projects/{project_id}/workflows/{workflow_id}/state-transitions")
and the other transition-related f-strings referenced (lines noted around 63-64,
90-92, 111-112) to append a trailing "/" and ensure the full path follows
"{base_path}/api/v1{resource_base_path}/{endpoint}/". Ensure any callers that
expect these endpoints continue to receive the normalized URLs.

In `@tests/unit/test_project_templates.py`:
- Around line 53-56: The test teardown currently swallows all exceptions (e.g.,
the client.project_templates.work_item_templates.delete(...) calls) using bare
"except Exception: pass"; replace each silent except with capturing the
exception (except Exception as e) and either log it with full exception info
(logger.exception or similar) or explicitly fail the test/raise so cleanup
errors are visible (e.g., pytest.fail or re-raise) for the calls in the teardown
blocks around the delete calls
(client.project_templates.work_item_templates.delete and related cleanup
statements referenced at the noted locations).

---

Nitpick comments:
In `@tests/unit/test_project_templates.py`:
- Around line 33-37: Test names use int(time.time()) which has 1s granularity
and causes collisions; update all uses of CreateWorkItemTemplate name formatting
to use a higher-entropy suffix (e.g., uuid.uuid4().hex or time.time_ns())
instead of int(time.time()) — search for CreateWorkItemTemplate in
tests/unit/test_project_templates.py (the occurrences around lines ~33, ~106,
~130, ~202) and replace the timestamp-based suffix with a uuid4 or nanosecond
timestamp to ensure unique names across fast/parallel runs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 774352eb-ccc9-4a15-bfec-afd85645afd7

📥 Commits

Reviewing files that changed from the base of the PR and between 88ade49 and 23e9f9e.

📒 Files selected for processing (17)
  • plane/__init__.py
  • plane/api/project_templates/__init__.py
  • plane/api/project_templates/base.py
  • plane/api/project_templates/page_templates.py
  • plane/api/project_templates/work_item_templates.py
  • plane/api/projects.py
  • plane/api/workflows/__init__.py
  • plane/api/workflows/base.py
  • plane/api/workflows/states.py
  • plane/api/workflows/transitions.py
  • plane/client/plane_client.py
  • plane/models/project_templates.py
  • plane/models/projects.py
  • plane/models/workflows.py
  • tests/unit/test_project_templates.py
  • tests/unit/test_projects.py
  • tests/unit/test_workflows.py

Comment thread plane/api/project_templates/page_templates.py Outdated
Comment thread plane/api/project_templates/work_item_templates.py Outdated
Comment thread plane/api/workflows/__init__.py Outdated
Comment thread plane/api/workflows/base.py Outdated
Comment thread plane/api/workflows/states.py Outdated
Comment thread plane/api/workflows/transitions.py Outdated
Comment thread tests/unit/test_project_templates.py Outdated
- Add trailing slashes to all API endpoint paths (workflows, workflow
  states, workflow transitions, work item templates, page templates)
- Sort __all__ in plane/api/workflows/__init__.py (Ruff RUF022)
- Replace int(time.time()) with uuid4().hex in test fixtures to prevent
  name collisions on fast/parallel runs
- Replace silent `except Exception: pass` with warnings.warn in test
  teardown to surface cleanup failures

Co-authored-by: Plane AI <noreply@plane.so>
@Prashant-Surya Prashant-Surya merged commit 553e9d4 into main May 29, 2026
1 check was pending
@Prashant-Surya Prashant-Surya deleted the infra-393/sdk-project-level-apis branch May 29, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants